<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>自定义组件-2</title>
		<script src="vue.js"></script>
	</head>

	<body>
		<div id="app">
			<p>{{myTitle}}</p>
			<my-component></my-component>
		</div>
	</body>
	<template id="myTmp">
		<p>{{myTitle}}</p>
	</template>
	<script>
		Vue.component('my-component', {
			template: '#myTmp',
			data() {
				return {
					myTitle: "当前自定义title内容",
				}
			}
		});
		var vm = new Vue({
			el: '#app',
			data: {
				myTitle: "根元素的title内容",
			}
		})
	</script>

</html>